import {
  Category,
  CategoryDocument,
} from '@app/database/schemas/category.schema';
import { Controller, Get } from '@nestjs/common';
import { InjectModel } from '@nestjs/mongoose';
import { ApiTags, ApiOperation } from '@nestjs/swagger';
import { Model } from 'mongoose';

@ApiTags('前台图书分类模块')
@Controller('categories')
export class CategoriesController {
  constructor(
    @InjectModel('Category')
    private readonly categoryModel: Model<CategoryDocument>,
  ) {}

  @ApiOperation({ summary: '所有分类' })
  @Get()
  findAll() {
    return this.categoryModel.find();
  }
}
